/*
 * NetCheckInView.java
 */

package com.google.code.netcheckin.app;

import com.google.code.netcheckin.aprs.Station;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.ListCellRenderer;
import java.util.Arrays;
import java.util.Stack;
import java.lang.Math;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JList;

/**
 * The application's main frame.
 */
public class NetCheckInView extends FrameView {

    public NetCheckInView(SingleFrameApplication app) {
        super(app);

        aprsSymbols = new AprsSymbols();
        
        initComponents();
        resetMissingInfo();
        
        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
         
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                }
            }
        });
        
        // Move this into a method soon
        ComboBoxRenderer renderer = new ComboBoxRenderer();
        renderer.setPreferredSize(new Dimension(60,30));
        primaryIconComboBox.setRenderer(renderer);
        
        ComboBoxRenderer renderer2 = new ComboBoxRenderer();
        renderer2.setPreferredSize(new Dimension(60,30));
        secondaryIconComboBox.setRenderer(renderer2);
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = NetCheckInApp.getApplication().getMainFrame();
            aboutBox = new NetCheckInAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        NetCheckInApp.getApplication().show(aboutBox);
    }
    
    @Action
    public void showConfigurationDialog() {
        if (configurationDialog == null) {
            JFrame mainFrame = NetCheckInApp.getApplication().getMainFrame();
            configurationDialog = new ConfigurationJDialog(mainFrame);
            configurationDialog.setLocationRelativeTo(mainFrame);
        } else {
            // else we just refresh the preferences before showing
            configurationDialog.readPrefs();
        }
        NetCheckInApp.getApplication().show(configurationDialog);
    }
    
    @Action
    public void checkInHome() {
        Object[] stationObjects = NetCheckInApp.getApplication().getStationObjects();
        int selection = predefinedStationsList.getSelectedIndex();
        Station station = (Station)stationObjects[selection];
        
        boolean xastirResult = NetCheckInApp.getApplication().objectToXastir(station, true);
        
        if (xastirResult) {
            javax.swing.DefaultListModel currentListModel = (javax.swing.DefaultListModel)currentCheckinsList.getModel();
            currentListModel.addElement(station.getCallsign());
            //javax.swing.DefaultListModel predefinedListModel = (javax.swing.DefaultListModel)predefinedStationsList.getModel();
            //predefinedListModel.removeElement(station.getCallsign());
        }
    }
    
    @Action
    public void checkInWork() {
        Object[] stationObjects = NetCheckInApp.getApplication().getStationObjects();
        int selection = predefinedStationsList.getSelectedIndex();
        Station station = (Station)stationObjects[selection];
        
        boolean xastirResult = NetCheckInApp.getApplication().objectToXastir(station, false);
        
        if (xastirResult) {
            javax.swing.DefaultListModel currentListModel = (javax.swing.DefaultListModel)currentCheckinsList.getModel();
            currentListModel.addElement(station.getCallsign());
            //javax.swing.DefaultListModel predefinedListModel = (javax.swing.DefaultListModel)predefinedStationsList.getModel();
            //predefinedListModel.removeElement(station.getCallsign());
        }
    }
    
    @Action
    public void newStation() {
        Station station = new Station();
        station.setCallsign("NEW");
        
        // These ints are defaulted to what will be needed for a clean slate
        // and no preexisting stations. Will be overridden if necessary
        int length = 0;
        int newlength = 1;
        
        Object[] stationObjects = NetCheckInApp.getApplication().getStationObjects();
        
        // Two scenarios to deal with: we already have existing stations, and
        // this is a fresh slate with no preexisting stations
        if (stationObjects != null) {
            length = stationObjects.length;
            newlength = length + 1;
            // TODO: replace this hack by moving from Array to a Collection
            //       for a dynamic collection
            stationObjects=(Object[]) Arrays.asList(stationObjects).toArray(new Object[newlength]);
            stationObjects[length] = station;
        } else {
            stationObjects = new Object[1];
            stationObjects[0] = station;
        }
        NetCheckInApp.getApplication().setStationObjects(stationObjects);
        // Refresh the list
        NetCheckInApp.getApplication().showPredefinedStations();
        // Update the selection
        predefinedStationsList.setSelectedIndex(length);
    }
    
    /**
     * clears the list of predefined calls
     */
    public void clearPredefinedCalls() {
        javax.swing.DefaultListModel listModel = (javax.swing.DefaultListModel)predefinedStationsList.getModel();
        listModel.clear();
    }
    
    /**
     * Adds a station to the predefined call list
     * @param s station to be added
     */
    public void addPredefinedCall(String s) {
        javax.swing.DefaultListModel listModel = (javax.swing.DefaultListModel)predefinedStationsList.getModel();
        listModel.addElement(s);
    }
    
    @Action
    public void saveAll() {
        // Find out what station is selected, then update the station array
        int selection = predefinedStationsList.getSelectedIndex();
        NetCheckInApp.getApplication().updateStationObjects(selection);
        NetCheckInApp.getApplication().saveAll();
        predefinedStationsList.setSelectedIndex(selection);
    }
      
       
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        currentCheckinsList = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        predefinedStationsList = new javax.swing.JList();
        homeCheckInButton = new javax.swing.JButton();
        workCheckInButton = new javax.swing.JButton();
        checkOutButton = new javax.swing.JButton();
        tabbedPane = new javax.swing.JTabbedPane();
        stationPanel = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        callsignTextField = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        nameTextField = new javax.swing.JTextField();
        aresCheckBox = new javax.swing.JCheckBox();
        racesCheckBox = new javax.swing.JCheckBox();
        jLabel5 = new javax.swing.JLabel();
        cellPhoneTextField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        emailTextField = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        commentTextField = new javax.swing.JTextField();
        homePanel = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        primaryAddressTextField = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        primaryCityTextField = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        primaryStateTextField = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        primaryZipTextField = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        primaryLatDegrees = new javax.swing.JTextField();
        primaryLatMinutes = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        primaryLongDegrees = new javax.swing.JTextField();
        primaryLongMinutes = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        primaryIconComboBox = primaryIconComboBox = new JComboBox(aprsSymbols.getIndexArray());
        primaryLatNButton = new javax.swing.JRadioButton();
        primaryLatSButton = new javax.swing.JRadioButton();
        primaryLongEButton = new javax.swing.JRadioButton();
        primaryLongWButton = new javax.swing.JRadioButton();
        workPanel = new javax.swing.JPanel();
        secondaryIconComboBox = secondaryIconComboBox = new JComboBox(aprsSymbols.getIndexArray());
        jLabel14 = new javax.swing.JLabel();
        secondaryLongMinutes = new javax.swing.JTextField();
        secondaryLongDegrees = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        secondaryLatMinutes = new javax.swing.JTextField();
        secondaryLatDegrees = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        secondaryZipTextField = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        secondaryStateTextField = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        secondaryCityTextField = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        secondaryAddressTextField = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        secondaryLatNButton = new javax.swing.JRadioButton();
        secondaryLatSButton = new javax.swing.JRadioButton();
        secondaryLongEButton = new javax.swing.JRadioButton();
        secondaryLongWButton = new javax.swing.JRadioButton();
        jCheckBox1 = new javax.swing.JCheckBox();
        commentOverrideTextField = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        newStationButton = new javax.swing.JButton();
        saveButton = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        configurationMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        buttonGroup4 = new javax.swing.ButtonGroup();

        mainPanel.setName("mainPanel"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.google.code.netcheckin.app.NetCheckInApp.class).getContext().getResourceMap(NetCheckInView.class);
        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        currentCheckinsList.setModel(new DefaultListModel());
        currentCheckinsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        currentCheckinsList.setName("currentCheckinsList"); // NOI18N
        currentCheckinsList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                currentCheckinsListValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(currentCheckinsList);

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        predefinedStationsList.setModel(new DefaultListModel());
        predefinedStationsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        predefinedStationsList.setName("predefinedStationsList"); // NOI18N
        predefinedStationsList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                predefinedStationsListValueChanged(evt);
            }
        });
        jScrollPane2.setViewportView(predefinedStationsList);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(com.google.code.netcheckin.app.NetCheckInApp.class).getContext().getActionMap(NetCheckInView.class, this);
        homeCheckInButton.setAction(actionMap.get("checkInHome")); // NOI18N
        homeCheckInButton.setText(resourceMap.getString("homeCheckInButton.text")); // NOI18N
        homeCheckInButton.setEnabled(false);
        homeCheckInButton.setName("homeCheckInButton"); // NOI18N

        workCheckInButton.setAction(actionMap.get("checkInWork")); // NOI18N
        workCheckInButton.setText(resourceMap.getString("workCheckInButton.text")); // NOI18N
        workCheckInButton.setEnabled(false);
        workCheckInButton.setName("workCheckInButton"); // NOI18N

        checkOutButton.setText(resourceMap.getString("checkOutButton.text")); // NOI18N
        checkOutButton.setEnabled(false);
        checkOutButton.setName("checkOutButton"); // NOI18N

        tabbedPane.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
        tabbedPane.setName("tabbedPane"); // NOI18N

        stationPanel.setBackground(resourceMap.getColor("stationPanel.background")); // NOI18N
        stationPanel.setName("stationPanel"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        callsignTextField.setText(resourceMap.getString("callsignTextField.text")); // NOI18N
        callsignTextField.setEnabled(false);
        callsignTextField.setName("callsignTextField"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        nameTextField.setText(resourceMap.getString("nameTextField.text")); // NOI18N
        nameTextField.setEnabled(false);
        nameTextField.setName("nameTextField"); // NOI18N

        aresCheckBox.setText(resourceMap.getString("aresCheckBox.text")); // NOI18N
        aresCheckBox.setEnabled(false);
        aresCheckBox.setName("aresCheckBox"); // NOI18N

        racesCheckBox.setText(resourceMap.getString("racesCheckBox.text")); // NOI18N
        racesCheckBox.setEnabled(false);
        racesCheckBox.setName("racesCheckBox"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        cellPhoneTextField.setText(resourceMap.getString("cellPhoneTextField.text")); // NOI18N
        cellPhoneTextField.setEnabled(false);
        cellPhoneTextField.setName("cellPhoneTextField"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        emailTextField.setText(resourceMap.getString("emailTextField.text")); // NOI18N
        emailTextField.setEnabled(false);
        emailTextField.setName("emailTextField"); // NOI18N

        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N

        commentTextField.setText(resourceMap.getString("commentTextField.text")); // NOI18N
        commentTextField.setEnabled(false);
        commentTextField.setName("commentTextField"); // NOI18N

        org.jdesktop.layout.GroupLayout stationPanelLayout = new org.jdesktop.layout.GroupLayout(stationPanel);
        stationPanel.setLayout(stationPanelLayout);
        stationPanelLayout.setHorizontalGroup(
            stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(stationPanelLayout.createSequentialGroup()
                .add(stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(stationPanelLayout.createSequentialGroup()
                        .add(jLabel3)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(callsignTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE))
                    .add(stationPanelLayout.createSequentialGroup()
                        .add(jLabel4)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(nameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE))
                    .add(stationPanelLayout.createSequentialGroup()
                        .add(aresCheckBox)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(racesCheckBox))
                    .add(stationPanelLayout.createSequentialGroup()
                        .add(jLabel5)
                        .add(30, 30, 30)
                        .add(cellPhoneTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE))
                    .add(stationPanelLayout.createSequentialGroup()
                        .add(jLabel6)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(emailTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE))
                    .add(stationPanelLayout.createSequentialGroup()
                        .add(jLabel21)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(commentTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)))
                .addContainerGap())
        );
        stationPanelLayout.setVerticalGroup(
            stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(stationPanelLayout.createSequentialGroup()
                .add(stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(callsignTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4)
                    .add(nameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(aresCheckBox)
                    .add(racesCheckBox))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(cellPhoneTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel5))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel6)
                    .add(emailTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(stationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel21)
                    .add(commentTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tabbedPane.addTab(resourceMap.getString("stationPanel.TabConstraints.tabTitle"), stationPanel); // NOI18N

        homePanel.setBackground(resourceMap.getColor("homePanel.background")); // NOI18N
        homePanel.setName("homePanel"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        primaryAddressTextField.setText(resourceMap.getString("primaryAddressTextField.text")); // NOI18N
        primaryAddressTextField.setEnabled(false);
        primaryAddressTextField.setName("primaryAddressTextField"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        primaryCityTextField.setText(resourceMap.getString("primaryCityTextField.text")); // NOI18N
        primaryCityTextField.setEnabled(false);
        primaryCityTextField.setName("primaryCityTextField"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        primaryStateTextField.setText(resourceMap.getString("primaryStateTextField.text")); // NOI18N
        primaryStateTextField.setEnabled(false);
        primaryStateTextField.setName("primaryStateTextField"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        primaryZipTextField.setText(resourceMap.getString("primaryZipTextField.text")); // NOI18N
        primaryZipTextField.setEnabled(false);
        primaryZipTextField.setName("primaryZipTextField"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        primaryLatDegrees.setText(resourceMap.getString("primaryLatDegrees.text")); // NOI18N
        primaryLatDegrees.setEnabled(false);
        primaryLatDegrees.setName("primaryLatDegrees"); // NOI18N

        primaryLatMinutes.setText(resourceMap.getString("primaryLatMinutes.text")); // NOI18N
        primaryLatMinutes.setEnabled(false);
        primaryLatMinutes.setName("primaryLatMinutes"); // NOI18N

        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        primaryLongDegrees.setText(resourceMap.getString("primaryLongDegrees.text")); // NOI18N
        primaryLongDegrees.setEnabled(false);
        primaryLongDegrees.setName("primaryLongDegrees"); // NOI18N

        primaryLongMinutes.setText(resourceMap.getString("primaryLongMinutes.text")); // NOI18N
        primaryLongMinutes.setEnabled(false);
        primaryLongMinutes.setName("primaryLongMinutes"); // NOI18N

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        primaryIconComboBox.setEnabled(false);
        primaryIconComboBox.setName("primaryIconComboBox"); // NOI18N

        buttonGroup1.add(primaryLatNButton);
        primaryLatNButton.setText(resourceMap.getString("primaryLatNButton.text")); // NOI18N
        primaryLatNButton.setActionCommand(resourceMap.getString("primaryLatNButton.actionCommand")); // NOI18N
        primaryLatNButton.setEnabled(false);
        primaryLatNButton.setName("primaryLatNButton"); // NOI18N

        buttonGroup1.add(primaryLatSButton);
        primaryLatSButton.setText(resourceMap.getString("primaryLatSButton.text")); // NOI18N
        primaryLatSButton.setActionCommand(resourceMap.getString("primaryLatSButton.actionCommand")); // NOI18N
        primaryLatSButton.setEnabled(false);
        primaryLatSButton.setName("primaryLatSButton"); // NOI18N

        buttonGroup2.add(primaryLongEButton);
        primaryLongEButton.setText(resourceMap.getString("primaryLongEButton.text")); // NOI18N
        primaryLongEButton.setActionCommand(resourceMap.getString("primaryLongEButton.actionCommand")); // NOI18N
        primaryLongEButton.setEnabled(false);
        primaryLongEButton.setName("primaryLongEButton"); // NOI18N

        buttonGroup2.add(primaryLongWButton);
        primaryLongWButton.setText(resourceMap.getString("primaryLongWButton.text")); // NOI18N
        primaryLongWButton.setActionCommand(resourceMap.getString("primaryLongWButton.actionCommand")); // NOI18N
        primaryLongWButton.setEnabled(false);
        primaryLongWButton.setName("primaryLongWButton"); // NOI18N

        org.jdesktop.layout.GroupLayout homePanelLayout = new org.jdesktop.layout.GroupLayout(homePanel);
        homePanel.setLayout(homePanelLayout);
        homePanelLayout.setHorizontalGroup(
            homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(homePanelLayout.createSequentialGroup()
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel7)
                    .add(jLabel8))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(primaryAddressTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 272, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(primaryCityTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE))
                .addContainerGap())
            .add(homePanelLayout.createSequentialGroup()
                .add(jLabel9)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(primaryStateTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel10)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(primaryZipTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE)
                .addContainerGap())
            .add(homePanelLayout.createSequentialGroup()
                .add(jLabel11)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(primaryLatDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(primaryLatMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(primaryLatNButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(primaryLatSButton)
                .add(90, 90, 90))
            .add(homePanelLayout.createSequentialGroup()
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, homePanelLayout.createSequentialGroup()
                        .add(jLabel13)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(primaryIconComboBox, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .add(org.jdesktop.layout.GroupLayout.LEADING, homePanelLayout.createSequentialGroup()
                        .add(jLabel12)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(primaryLongDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(primaryLongMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(primaryLongEButton)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(primaryLongWButton)
                .add(78, 78, 78))
        );
        homePanelLayout.setVerticalGroup(
            homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(homePanelLayout.createSequentialGroup()
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel7)
                    .add(primaryAddressTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel8)
                    .add(primaryCityTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel9)
                    .add(primaryStateTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel10)
                    .add(primaryZipTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel11)
                    .add(primaryLatDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(primaryLatMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(primaryLatNButton)
                    .add(primaryLatSButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel12)
                    .add(primaryLongDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(primaryLongMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(primaryLongEButton)
                    .add(primaryLongWButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(homePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel13)
                    .add(primaryIconComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tabbedPane.addTab(resourceMap.getString("homePanel.TabConstraints.tabTitle"), homePanel); // NOI18N

        workPanel.setBackground(resourceMap.getColor("workPanel.background")); // NOI18N
        workPanel.setName("workPanel"); // NOI18N

        secondaryIconComboBox.setEnabled(false);
        secondaryIconComboBox.setName("secondaryIconComboBox"); // NOI18N

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        secondaryLongMinutes.setText(resourceMap.getString("secondaryLongMinutes.text")); // NOI18N
        secondaryLongMinutes.setEnabled(false);
        secondaryLongMinutes.setName("secondaryLongMinutes"); // NOI18N

        secondaryLongDegrees.setText(resourceMap.getString("secondaryLongDegrees.text")); // NOI18N
        secondaryLongDegrees.setEnabled(false);
        secondaryLongDegrees.setName("secondaryLongDegrees"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        secondaryLatMinutes.setText(resourceMap.getString("secondaryLatMinutes.text")); // NOI18N
        secondaryLatMinutes.setEnabled(false);
        secondaryLatMinutes.setName("secondaryLatMinutes"); // NOI18N

        secondaryLatDegrees.setText(resourceMap.getString("secondaryLatDegrees.text")); // NOI18N
        secondaryLatDegrees.setEnabled(false);
        secondaryLatDegrees.setName("secondaryLatDegrees"); // NOI18N

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        secondaryZipTextField.setText(resourceMap.getString("secondaryZipTextField.text")); // NOI18N
        secondaryZipTextField.setEnabled(false);
        secondaryZipTextField.setName("secondaryZipTextField"); // NOI18N

        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        secondaryStateTextField.setText(resourceMap.getString("secondaryStateTextField.text")); // NOI18N
        secondaryStateTextField.setEnabled(false);
        secondaryStateTextField.setName("secondaryStateTextField"); // NOI18N

        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        secondaryCityTextField.setText(resourceMap.getString("secondaryCityTextField.text")); // NOI18N
        secondaryCityTextField.setEnabled(false);
        secondaryCityTextField.setName("secondaryCityTextField"); // NOI18N

        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        secondaryAddressTextField.setText(resourceMap.getString("secondaryAddressTextField.text")); // NOI18N
        secondaryAddressTextField.setEnabled(false);
        secondaryAddressTextField.setName("secondaryAddressTextField"); // NOI18N

        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N

        buttonGroup3.add(secondaryLatNButton);
        secondaryLatNButton.setText(resourceMap.getString("secondaryLatNButton.text")); // NOI18N
        secondaryLatNButton.setActionCommand(resourceMap.getString("secondaryLatNButton.actionCommand")); // NOI18N
        secondaryLatNButton.setEnabled(false);
        secondaryLatNButton.setName("secondaryLatNButton"); // NOI18N

        buttonGroup3.add(secondaryLatSButton);
        secondaryLatSButton.setText(resourceMap.getString("secondaryLatSButton.text")); // NOI18N
        secondaryLatSButton.setActionCommand(resourceMap.getString("secondaryLatSButton.actionCommand")); // NOI18N
        secondaryLatSButton.setEnabled(false);
        secondaryLatSButton.setName("secondaryLatSButton"); // NOI18N

        buttonGroup4.add(secondaryLongEButton);
        secondaryLongEButton.setText(resourceMap.getString("secondaryLongEButton.text")); // NOI18N
        secondaryLongEButton.setActionCommand(resourceMap.getString("secondaryLongEButton.actionCommand")); // NOI18N
        secondaryLongEButton.setEnabled(false);
        secondaryLongEButton.setName("secondaryLongEButton"); // NOI18N

        buttonGroup4.add(secondaryLongWButton);
        secondaryLongWButton.setText(resourceMap.getString("secondaryLongWButton.text")); // NOI18N
        secondaryLongWButton.setActionCommand(resourceMap.getString("secondaryLongWButton.actionCommand")); // NOI18N
        secondaryLongWButton.setEnabled(false);
        secondaryLongWButton.setName("secondaryLongWButton"); // NOI18N

        org.jdesktop.layout.GroupLayout workPanelLayout = new org.jdesktop.layout.GroupLayout(workPanel);
        workPanel.setLayout(workPanelLayout);
        workPanelLayout.setHorizontalGroup(
            workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(workPanelLayout.createSequentialGroup()
                .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(workPanelLayout.createSequentialGroup()
                            .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jLabel20)
                                .add(jLabel19))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                .add(secondaryCityTextField)
                                .add(secondaryAddressTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)))
                        .add(workPanelLayout.createSequentialGroup()
                            .add(jLabel18)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(secondaryStateTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(jLabel17)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(secondaryZipTextField)))
                    .add(workPanelLayout.createSequentialGroup()
                        .add(jLabel16)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(secondaryLatDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(secondaryLatMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(secondaryLatNButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(secondaryLatSButton))
                    .add(workPanelLayout.createSequentialGroup()
                        .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, workPanelLayout.createSequentialGroup()
                                .add(jLabel14)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(secondaryIconComboBox, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .add(org.jdesktop.layout.GroupLayout.LEADING, workPanelLayout.createSequentialGroup()
                                .add(jLabel15)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(secondaryLongDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(secondaryLongMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(secondaryLongEButton)))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(secondaryLongWButton)))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        workPanelLayout.setVerticalGroup(
            workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(workPanelLayout.createSequentialGroup()
                .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel20)
                    .add(secondaryAddressTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel19)
                    .add(secondaryCityTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel18)
                    .add(secondaryStateTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel17)
                    .add(secondaryZipTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel16)
                    .add(secondaryLatDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(secondaryLatMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(secondaryLatNButton)
                    .add(secondaryLatSButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel15)
                    .add(secondaryLongDegrees, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(secondaryLongMinutes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(secondaryLongEButton)
                    .add(secondaryLongWButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(workPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel14)
                    .add(secondaryIconComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tabbedPane.addTab(resourceMap.getString("workPanel.TabConstraints.tabTitle"), workPanel); // NOI18N

        jCheckBox1.setText(resourceMap.getString("jCheckBox1.text")); // NOI18N
        jCheckBox1.setName("jCheckBox1"); // NOI18N

        commentOverrideTextField.setText(resourceMap.getString("commentOverrideTextField.text")); // NOI18N
        commentOverrideTextField.setName("commentOverrideTextField"); // NOI18N

        jPanel2.setName("jPanel2"); // NOI18N

        newStationButton.setAction(actionMap.get("newStation")); // NOI18N
        newStationButton.setText(resourceMap.getString("newStationButton.text")); // NOI18N
        newStationButton.setName("newStationButton"); // NOI18N

        saveButton.setAction(actionMap.get("saveAll")); // NOI18N
        saveButton.setText(resourceMap.getString("saveButton.text")); // NOI18N
        saveButton.setEnabled(false);
        saveButton.setName("saveButton"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(505, Short.MAX_VALUE)
                .add(saveButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(newStationButton))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(newStationButton)
                .add(saveButton))
        );

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel1)
                            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 168, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, tabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                                .add(checkOutButton)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 106, Short.MAX_VALUE)
                                .add(homeCheckInButton))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, workCheckInButton)
                            .add(jCheckBox1)
                            .add(commentOverrideTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel2)
                            .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 178, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap(20, Short.MAX_VALUE)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel1)
                    .add(jLabel2))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jScrollPane1)
                    .add(jScrollPane2)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(checkOutButton)
                            .add(homeCheckInButton))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(workCheckInButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(tabbedPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 250, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jCheckBox1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(commentOverrideTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );

        org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(mainPanelLayout.createSequentialGroup()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        configurationMenuItem.setAction(actionMap.get("showConfigurationDialog")); // NOI18N
        configurationMenuItem.setText(resourceMap.getString("configurationMenuItem.text")); // NOI18N
        configurationMenuItem.setToolTipText(resourceMap.getString("configurationMenuItem.toolTipText")); // NOI18N
        configurationMenuItem.setName("configurationMenuItem"); // NOI18N
        fileMenu.add(configurationMenuItem);

        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        org.jdesktop.layout.GroupLayout statusPanelLayout = new org.jdesktop.layout.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE)
            .add(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(statusMessageLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 734, Short.MAX_VALUE)
                .add(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(statusPanelLayout.createSequentialGroup()
                .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(statusMessageLabel)
                    .add(statusAnimationLabel))
                .add(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    /**
     * returns the station that is selected in the Predefined Stations list
     * If the selected index is out of the range of the array, then returns null
     * @return Station
     */
    public Station getSelectedPredefinedStation() {
        Object[] stationObjects = NetCheckInApp.getApplication().getStationObjects();
        int selection = predefinedStationsList.getSelectedIndex();
        //System.out.println("array size " + stationObjects.length + " selection " + selection);
        if (selection >= 0 && selection <= stationObjects.length) {
            return (Station)stationObjects[selection];
        } else {
            return null;
        }
    }
    
    /**
     * Returns the station that is selected in the Checked In stations list
     * @return
     */
    public Station getCheckedInStation() {
        // TODO: finish this
        return null;
    }
    
    /**
     * sets the GUI text fields with relevant info from the given Station
     * @param station
     */
    public void setStationTextFields(Station station) {
        callsignTextField.setText(station.getCallsign());
        cellPhoneTextField.setText(station.getCellphone());
        emailTextField.setText(station.getEmail());
        nameTextField.setText(station.getName());
        primaryAddressTextField.setText(station.getPrimaryAddress());
        primaryCityTextField.setText(station.getPrimaryCity());
        primaryStateTextField.setText(station.getPrimaryState());
        primaryZipTextField.setText(station.getPrimaryZip());
        primaryLatDegrees.setText("" + station.getPrimaryLatitude1());
        primaryLatMinutes.setText("" + station.getPrimaryLatitude2());
        primaryLongDegrees.setText("" + station.getPrimaryLongitude1());
        primaryLongMinutes.setText("" + station.getPrimaryLongitude2());
        secondaryAddressTextField.setText(station.getSecondaryAddress());
        secondaryCityTextField.setText(station.getSecondaryCity());
        secondaryStateTextField.setText(station.getSecondaryState());
        secondaryZipTextField.setText(station.getSecondaryZip());
        secondaryLatDegrees.setText("" + station.getSecondaryLatitude1());
        secondaryLatMinutes.setText("" + station.getSecondaryLatitude2());
        secondaryLongDegrees.setText("" + station.getSecondaryLongitude1());
        secondaryLongMinutes.setText("" + station.getSecondaryLongitude2());
        if (station.getIsAres()) {
            aresCheckBox.setSelected(true);
        } else {
            aresCheckBox.setSelected(false);
        }
        if (station.getIsRaces()) {
            racesCheckBox.setSelected(true);
        } else {
            racesCheckBox.setSelected(false);
        }
        if (station.getPrimaryLatitudeOrientation() == 'N') {
            primaryLatNButton.setSelected(true);
            primaryLatSButton.setSelected(false);
        } else {
            primaryLatSButton.setSelected(true);
            primaryLatNButton.setSelected(false);
        }
        if (station.getPrimaryLongitudeOrientation() == 'W') {
            primaryLongWButton.setSelected(true);
            primaryLongEButton.setSelected(false);
        } else {
            primaryLongEButton.setSelected(true);
            primaryLongWButton.setSelected(false);
        }
        if (station.getSecondaryLatitudeOrientation() == 'N') {
            secondaryLatNButton.setSelected(true);
            secondaryLatSButton.setSelected(false);
        } else {
            secondaryLatSButton.setSelected(true);
            secondaryLatNButton.setSelected(false);
        }
        if (station.getSecondaryLongitudeOrientation() == 'W') {
            secondaryLongWButton.setSelected(true);
            secondaryLongEButton.setSelected(false);
        } else {
            secondaryLongEButton.setSelected(true);
            secondaryLongWButton.setSelected(false);
        }
        
        // TODO: Add error checking here (what happens when we ask for a symbol
        // unsupported by aprsSymbols?
        int primarySymbolIndex = aprsSymbols.getIndexOfSymbol(station.getPrimaryIcon());
        primaryIconComboBox.setSelectedIndex(primarySymbolIndex);
        
        int secondarySymbolIndex = aprsSymbols.getIndexOfSymbol(station.getSecondaryIcon());
        secondaryIconComboBox.setSelectedIndex(secondarySymbolIndex);
    }
    
    /**
     * Update the GUI with information from a station object in the Predefined
     * Stations list anytime one is clicked on
     * @param evt
     */
    private void predefinedStationsListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_predefinedStationsListValueChanged
        
        Station station = getSelectedPredefinedStation();
        if (station != null) {
            // Got the station, now update the fields
            setStationTextFields(station);

            // Set up buttons
            if (station.isPrimaryCoordinateValid()) {
                homeCheckInButton.setEnabled(true);
                homeCheckInButton.setToolTipText("Click to send the selected " +
                    "station to Xastir using Home QTH coordinates.");
            } else {
                homeCheckInButton.setEnabled(false);
                homeCheckInButton.setToolTipText("Valid coordinates are " +
                    "needed. Click on Home QTH to set these.");
            }
            if (station.isSecondaryCoordinateValid()) {
                workCheckInButton.setEnabled(true);
                workCheckInButton.setToolTipText("Click to send the selected " +
                    "station to Xastir using Work QTH coordinates.");
            } else {
                workCheckInButton.setEnabled(false);
                workCheckInButton.setToolTipText("Valid coordinates are " +
                    "needed. Click on Work QTH to set these.");
            }
            checkOutButton.setEnabled(false);
            
            enableStationEdit();

            // reset the tab to the Station tab.  may want to take out - usability?
            tabbedPane.setSelectedIndex(0);

            //  testing goes here
            //System.out.println(station.getPrimaryLongitudeOrientation());
            }
    }//GEN-LAST:event_predefinedStationsListValueChanged

    private void currentCheckinsListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_currentCheckinsListValueChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_currentCheckinsListValueChanged

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox aresCheckBox;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.ButtonGroup buttonGroup4;
    private javax.swing.JTextField callsignTextField;
    private javax.swing.JTextField cellPhoneTextField;
    private javax.swing.JButton checkOutButton;
    private javax.swing.JTextField commentOverrideTextField;
    private javax.swing.JTextField commentTextField;
    private javax.swing.JMenuItem configurationMenuItem;
    private javax.swing.JList currentCheckinsList;
    private javax.swing.JTextField emailTextField;
    private javax.swing.JButton homeCheckInButton;
    private javax.swing.JPanel homePanel;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JTextField nameTextField;
    private javax.swing.JButton newStationButton;
    private javax.swing.JList predefinedStationsList;
    private javax.swing.JTextField primaryAddressTextField;
    private javax.swing.JTextField primaryCityTextField;
    private javax.swing.JComboBox primaryIconComboBox;
    private javax.swing.JTextField primaryLatDegrees;
    private javax.swing.JTextField primaryLatMinutes;
    private javax.swing.JRadioButton primaryLatNButton;
    private javax.swing.JRadioButton primaryLatSButton;
    private javax.swing.JTextField primaryLongDegrees;
    private javax.swing.JRadioButton primaryLongEButton;
    private javax.swing.JTextField primaryLongMinutes;
    private javax.swing.JRadioButton primaryLongWButton;
    private javax.swing.JTextField primaryStateTextField;
    private javax.swing.JTextField primaryZipTextField;
    private javax.swing.JCheckBox racesCheckBox;
    private javax.swing.JButton saveButton;
    private javax.swing.JTextField secondaryAddressTextField;
    private javax.swing.JTextField secondaryCityTextField;
    private javax.swing.JComboBox secondaryIconComboBox;
    private javax.swing.JTextField secondaryLatDegrees;
    private javax.swing.JTextField secondaryLatMinutes;
    private javax.swing.JRadioButton secondaryLatNButton;
    private javax.swing.JRadioButton secondaryLatSButton;
    private javax.swing.JTextField secondaryLongDegrees;
    private javax.swing.JRadioButton secondaryLongEButton;
    private javax.swing.JTextField secondaryLongMinutes;
    private javax.swing.JRadioButton secondaryLongWButton;
    private javax.swing.JTextField secondaryStateTextField;
    private javax.swing.JTextField secondaryZipTextField;
    private javax.swing.JPanel stationPanel;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JTabbedPane tabbedPane;
    private javax.swing.JButton workCheckInButton;
    private javax.swing.JPanel workPanel;
    // End of variables declaration//GEN-END:variables
    private ConfigurationJDialog configurationDialog;
    private Stack missingInfo;
    
    public String getCallsign() {
        if (callsignTextField.getText().equals("") || callsignTextField.getText().equals("NEW")) {
            missingInfo.push("Callsign of station");
        }
        return callsignTextField.getText();
    }
    
    public String getCellPhone() {
        return cellPhoneTextField.getText();
    }
    
    public String getStationName() {
        if (nameTextField.getText().equals("")) {
            missingInfo.push("Name of station");
        }
        return nameTextField.getText();
    }
    
    public String getEmail() {
        return emailTextField.getText();
    }
    
    public boolean isAres() {
        if (aresCheckBox.isSelected()) {
            return true;
        } else {
            return false;
        }
    }
    
    public boolean isRaces() {
        if (racesCheckBox.isSelected()) {
            return true;
        } else {
            return false;
        }
    }
    
    public String getPrimaryAddress() {
        return primaryAddressTextField.getText();
    }
    
    public String getSecondaryAddress() {
        return secondaryAddressTextField.getText();
    }
    
    public String getPrimaryState() {
        return primaryStateTextField.getText();
    }
    
    public String getSecondaryState() {
        return secondaryStateTextField.getText();
    }
    
    public String getPrimaryZip() {
        return primaryZipTextField.getText();
    }
    
    public String getSecondaryZip() {
        return secondaryZipTextField.getText();
    }
    
    public String getPrimaryCity() {
        return primaryCityTextField.getText();
    }
    
    public String getSecondaryCity() {
        return secondaryCityTextField.getText();
    }
    
    public int getPrimaryLatDegrees() {
        if (primaryLatDegrees.getText().equals("") || 
            primaryLatDegrees.getText().equals("0") ||
            (Math.abs(Integer.valueOf(primaryLatDegrees.getText())) > 90)) {
            missingInfo.push("Primary location latitude degrees");
            return Integer.valueOf("0");
        } else {
            return Integer.valueOf(primaryLatDegrees.getText()).intValue();
        }
    }
    
    public int getSecondaryLatDegrees() {
        if (secondaryLatDegrees.getText().equals("") || 
            secondaryLatDegrees.getText().equals("0") ||
            (Math.abs(Integer.valueOf(secondaryLatDegrees.getText())) > 90)) {
            missingInfo.push("Secondary location latitude degrees");
            return Integer.valueOf("0");
        } else {
            return Integer.valueOf(secondaryLatDegrees.getText()).intValue();
        }
    }
    
    public Float getPrimaryLatMinutes() {
        if (primaryLatMinutes.getText().equals("") ||
            primaryLatMinutes.getText().equals("0.0") ||
            (Math.abs(Float.valueOf(primaryLatMinutes.getText())) > 100.0)) {
            missingInfo.push("Primary location latitude minutes");
            return Float.valueOf("0");
        } else {
            return Float.valueOf(primaryLatMinutes.getText()).floatValue();
        }
    }
    
    public Float getSecondaryLatMinutes() {
        if (secondaryLatMinutes.getText().equals("") ||
            secondaryLatMinutes.getText().equals("0.0") ||
            (Math.abs(Float.valueOf(secondaryLatMinutes.getText())) > 100.0)) {
            missingInfo.push("Secondary location latitude minutes");
            return Float.valueOf("0");
        } else {
            return Float.valueOf(secondaryLatMinutes.getText()).floatValue();
        }
    }
    
    public int getPrimaryLongDegrees() {
        if (primaryLongDegrees.getText().equals("") ||
            primaryLongDegrees.getText().equals("0") ||
            (Math.abs(Integer.valueOf(primaryLongDegrees.getText())) > 180)) {
            missingInfo.push("Primary location longitude degrees");
            return Integer.valueOf("0");
        } else {
            return Integer.valueOf(primaryLongDegrees.getText()).intValue();
        }
    }
    
    public int getSecondaryLongDegrees() {
        if (secondaryLongDegrees.getText().equals("") ||
            secondaryLongDegrees.getText().equals("0") ||
            (Math.abs(Integer.valueOf(secondaryLongDegrees.getText())) > 180)) {
            missingInfo.push("Secondary location longitude degrees");
            return Integer.valueOf("0");
        } else {
            return Integer.valueOf(secondaryLongDegrees.getText()).intValue();
        }
    }
    
    public Float getPrimaryLongMinutes() {
        if (primaryLongMinutes.getText().equals("") ||
            primaryLongMinutes.getText().equals("0.0") ||
            (Math.abs(Float.valueOf(primaryLongMinutes.getText())) > 100.0)) {
            missingInfo.push("Primary location longitude minutes");
            return Float.valueOf("0");
        } else {
            return Float.valueOf(primaryLongMinutes.getText()).floatValue();
        }
    }
    
    public Float getSecondaryLongMinutes() {
        if (secondaryLongMinutes.getText().equals("") ||
            secondaryLongMinutes.getText().equals("0.0") ||
            (Math.abs(Float.valueOf(secondaryLongMinutes.getText())) > 100.0)) {
            missingInfo.push("Secondary location longitude minutes");
            return Float.valueOf("0");
        } else {
            return Float.valueOf(secondaryLongMinutes.getText()).floatValue();
        }
    }
    
    public char getPrimaryLatOrientation() {
        javax.swing.ButtonModel b = buttonGroup1.getSelection();
        if (b == null) {
            missingInfo.push("Primary location latitude orientation");
            return 'N';
        } else {
            String s = b.getActionCommand();
            return s.charAt(0);
        }
    }
    
    public char getSecondaryLatOrientation() {
        javax.swing.ButtonModel b = buttonGroup3.getSelection();
        if (b == null) {
            missingInfo.push("Secondary location latitude orientation");
            return 'N';
        } else {
            String s = b.getActionCommand();
            return s.charAt(0);
        }
    }
    
    public char getPrimaryLongOrientation() {
        javax.swing.ButtonModel b = buttonGroup2.getSelection();
        if (b == null) {
            missingInfo.push("Primary location longitude orientation");
            return 'W';
        } else {
            String s = b.getActionCommand();
            return s.charAt(0);
        }
    }
    
    public char getSecondaryLongOrientation() {
        javax.swing.ButtonModel b = buttonGroup4.getSelection();
        if (b == null) {
            missingInfo.push("Secondary location longitude orientation");
            return 'W';
        } else {
            String s = b.getActionCommand();
            return s.charAt(0);
        }
    }
    
    public String getPrimaryIcon() {
        int symbolIndex = primaryIconComboBox.getSelectedIndex();
        return aprsSymbols.getSymbol(symbolIndex);
    }
    
    public String getSecondaryIcon() {
        int symbolIndex = secondaryIconComboBox.getSelectedIndex();
        return aprsSymbols.getSymbol(symbolIndex);
    }
    
    public void enableSaveButton() {
        saveButton.setEnabled(true);
    }
    
    public void disableSaveButton() {
        saveButton.setEnabled(false);
    }
    
    public void enableStationEdit() {
        saveButton.setEnabled(true);
        callsignTextField.setEnabled(true);
        nameTextField.setEnabled(true);
        aresCheckBox.setEnabled(true);
        racesCheckBox.setEnabled(true);
        cellPhoneTextField.setEnabled(true);
        emailTextField.setEnabled(true);
        commentTextField.setEnabled(true);
        primaryAddressTextField.setEnabled(true);
        primaryCityTextField.setEnabled(true);
        primaryStateTextField.setEnabled(true);
        primaryZipTextField.setEnabled(true);
        primaryLatDegrees.setEnabled(true);
        primaryLatMinutes.setEnabled(true);
        primaryLongDegrees.setEnabled(true);
        primaryLongMinutes.setEnabled(true);
        primaryIconComboBox.setEnabled(true);
        primaryLatNButton.setEnabled(true);
        primaryLatSButton.setEnabled(true);
        primaryLongWButton.setEnabled(true);
        primaryLongEButton.setEnabled(true);
        secondaryAddressTextField.setEnabled(true);
        secondaryCityTextField.setEnabled(true);
        secondaryStateTextField.setEnabled(true);
        secondaryZipTextField.setEnabled(true);
        secondaryLatDegrees.setEnabled(true);
        secondaryLatMinutes.setEnabled(true);
        secondaryLongDegrees.setEnabled(true);
        secondaryLongMinutes.setEnabled(true);
        secondaryIconComboBox.setEnabled(true);
        secondaryLatNButton.setEnabled(true);
        secondaryLatSButton.setEnabled(true);
        secondaryLongWButton.setEnabled(true);
        secondaryLongEButton.setEnabled(true);
    }
    
    public void disableStationEdit() {
        saveButton.setEnabled(false);
        callsignTextField.setEnabled(false);
        nameTextField.setEnabled(false);
        aresCheckBox.setEnabled(false);
        racesCheckBox.setEnabled(false);
        cellPhoneTextField.setEnabled(false);
        emailTextField.setEnabled(false);
        commentTextField.setEnabled(false);
        primaryAddressTextField.setEnabled(false);
        primaryCityTextField.setEnabled(false);
        primaryStateTextField.setEnabled(false);
        primaryZipTextField.setEnabled(false);
        primaryLatDegrees.setEnabled(false);
        primaryLatMinutes.setEnabled(false);
        primaryLongDegrees.setEnabled(false);
        primaryLongMinutes.setEnabled(false);
        primaryIconComboBox.setEnabled(false);
        primaryLatNButton.setEnabled(false);
        primaryLatSButton.setEnabled(false);
        primaryLongWButton.setEnabled(false);
        primaryLongEButton.setEnabled(false);
        secondaryAddressTextField.setEnabled(false);
        secondaryCityTextField.setEnabled(false);
        secondaryStateTextField.setEnabled(false);
        secondaryZipTextField.setEnabled(false);
        secondaryLatDegrees.setEnabled(false);
        secondaryLatMinutes.setEnabled(false);
        secondaryLongDegrees.setEnabled(false);
        secondaryLongMinutes.setEnabled(false);
        secondaryIconComboBox.setEnabled(false);
        secondaryLatNButton.setEnabled(false);
        secondaryLatSButton.setEnabled(false);
        secondaryLongWButton.setEnabled(false);
        secondaryLongEButton.setEnabled(false);
    }
    
    /** 
     * Resets a stack of strings that tracks critical info that has been
     * attempted to retrieve from the GUI but was missing. Used in error msg
     */
    public void resetMissingInfo() {
        missingInfo = new Stack();
    }
    
    /**
     * 
     * @return Stack of strings describing missing info from the GUI
     */
    public Stack getMissingInfo() {
        return missingInfo;
    }
    
    public boolean isMissingInfo() {
        if (!missingInfo.empty()) {
            return true;
        }
        return false;
    }
    
    public void setStatusMessage(String msg) {
        statusMessageLabel.setText(msg);
        messageTimer.restart();
    }
    
    // Quick hack.  might remove later?
    //public Object[] getSymbolsList() {
    //    return aprsSymbols.getIndex();
    //}
    
    class ComboBoxRenderer extends JLabel
                           implements ListCellRenderer {
        private Font uhOhFont;
        //private ImageIcon[] iconArray = aprsSymbols.getIcons();

        public ComboBoxRenderer() {
            setOpaque(true);
            setHorizontalAlignment(LEFT);
            setVerticalAlignment(CENTER);
        }

        /*
         * This method finds the image and text corresponding
         * to the selected value and returns the label, set up
         * to display the text and image.
         */
        public Component getListCellRendererComponent(
                                           JList list,
                                           Object value,
                                           int index,
                                           boolean isSelected,
                                           boolean cellHasFocus) {
            //Get the selected index. (The index param isn't
            //always valid, so just use the value.)
            int selectedIndex = ((Integer)value).intValue();

            if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
            } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
            }

            //Set the icon and text.  If icon was null, say so.
            ImageIcon icon = aprsSymbols.getIcon(selectedIndex); //images[selectedIndex];
            //ImageIcon icon = iconArray[selectedIndex];
            String description = aprsSymbols.getDescription(selectedIndex); //symbolStrings[selectedIndex];
            String aprsSymbol = aprsSymbols.getSymbol(selectedIndex);
            setIcon(icon);
            if (icon != null) {
                setText(description);
                setFont(list.getFont());
                //System.out.println("Setting value " + aprsSymbol);
            } else {
                setUhOhText(description + " (no image available)",
                            list.getFont());
            }

            return this;
        }

        //Set the font and text when no image was found.
        protected void setUhOhText(String uhOhText, Font normalFont) {
            if (uhOhFont == null) { //lazily create this font
                uhOhFont = normalFont.deriveFont(Font.ITALIC);
            }
            setFont(uhOhFont);
            setText(uhOhText);
        }
    }
    
    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
    
    private AprsSymbols aprsSymbols;
}
